﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.Threading;

using Ycg.Windows;

namespace Ycg.NLogging
{
    public class LogInfo
    {
        private DateTime _currentDateTime = DateTime.Now;
        private string _threadName = Thread.CurrentThread.Name;
        private string _machineName = Environment.MachineName;
        private int _threadID = Thread.CurrentThread.ManagedThreadId;
        private string _appDomainName = AppDomain.CurrentDomain.FriendlyName;  //其实就是应用程序域的名称
        private string _applicationName = Process.GetCurrentProcess().ProcessName;
        private string _currentProcessID = WindowsAPI.GetCurrentProcessId().ToString(CultureInfo.InvariantCulture);

        public LogInfo()
        {
        }

        //public LogInfo(TraceEventType type)
        //{
        //    this.Type = type;
        //}

        /// <summary>
        /// 日志记录时间
        /// </summary>
        public DateTime Date
        {
            get { return this._currentDateTime; }
        }

        /// <summary>
        /// 线程ID
        /// </summary>
        public int ThreadID
        {
            get { return this._threadID; }
            set { this._threadID = value; }
        }

        /// <summary>
        /// 线程名称
        /// </summary>
        public string ThreadName
        {
            get { return this._threadName; }
            set { this._threadName = value; }
        }

        /// <summary>
        /// 机器名
        /// </summary>
        public string MachineName
        {
            get { return this._machineName; }
            set { this._machineName = value; }
        }

        /// <summary>
        /// 应用程序域名称
        /// </summary>
        public string ApplicationName
        {
            get { return this._applicationName; }
            set { this._applicationName = value; }
        }

        /// <summary>
        /// 日志消息
        /// </summary>
        public string Message { get; set; }

        /// <summary>
        /// 堆栈信息
        /// </summary>
        public string StackTrace { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        public string VersionNumber { get; set; }

        /// <summary>
        /// 日志类型
        /// </summary>
        public TraceEventType Type { get; set; }
    }
}
